<?php

abstract class Adept_Dispatcher_ArrayBased extends Adept_Dispatcher {

    protected $defaultController;

    public function __construct() {
        $routes = $this->defineRoutes();
        foreach ($routes as $routePattern => $routeOptions) {
            $controller = null;
            if (isset($routeOptions['controller'])) {
                $controller = $routeOptions['controller'];
                unset($routeOptions['controller']);
            } else {
                $controller = $this->defaultController;
            }
            $this->addNewRoute($routePattern, $controller, $routeOptions);
        }
    }

    abstract function defineRoutes();
    
    public function getDefaultController() 
    {
        return $this->defaultController;
    }
    
    public function setDefaultController($defaultController) 
    {
        $this->defaultController = $defaultController;
    }

}